<?php
include '../conn.php';
include "t-cookie.php";

$sid=$_GET["sid"];

?>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>成绩考核表-学生端</title>
    <link rel="stylesheet" type="text/css" href="../css/htmleaf-demo.css">
    <link rel="stylesheet" type="text/css" href="../css/nav.css">
    <link rel="stylesheet" type="text/css" href="../fonts/iconfont.css">

    <link rel="stylesheet" href="../css/bootstrap-theme.css"/>

    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <link rel="stylesheet" href="../css/bootstrap-theme.min.css"/>
    <link rel="stylesheet" href="../css/bootstrap.css"/>
    <script type="text/javascript" src="../js/bootstrap3.0.3.min.js"></script>

    <style>
        #out {
            position: absolute;
            right: 30px;
            top: 20px;
            z-index: 100000;
        }

        .topx {
            margin: 0px;
            padding-top: 50px;
            position: fixed;
            z-index: 999;
            /*浮动部分*/
            /*float:left; */
        }

        .navfont {
            font-family: "黑体";
            font-size: 1.5em;
            padding-top: 10px;
        }

        .indexborder {
            border: 1px transparent;
            border-color: transparent;
            border-color: rgba(0, 0, 0, 0);
            margin-left: 285px;
            margin-right: 5%;

        }

        .bodycolor {
            background-color: gainsboro;
        }

        .box-inline {
            box-shadow: 0px 2px 2px grey;
        }

        .indexdiv1 {
            margin-top: 70px;
            margin-bottom: 20px;
            /*margin-left: 0px;*/
            padding: 2% 2% 2% 2%;
            width: 100%;
            /*height:400px;*/
        }

        .navbackground-s {
            background-color: #0a2448;
        }

        .indexfooter {
            background-color: dimgray;
            /*height: 50px;*/
            position: absolute;
            /*position: absolute;*/
            bottom: 0px;
            width: 100%;
        }

        .footer-p {
            padding-top: 10px;
            padding-left: 210px;
            /*text-align: center;*/
        }

        .paneldiv {
            margin-left: 40px;
        }

        table {
            width: 80%;
            height: 80%;
        }

        .table-position {
            top: 50%;
            left: 50%;
        }

        caption {
            text-align: center;
        }

        .table-striped {
            background-color: aliceblue;
        }

        .thcolor {
            background-color: steelblue;
        }

        .thcolor th:nth-child(1) {
            width: 10%;
        }

        .thcolor th:nth-child(2) {
            width: 30%;
        }

        .thcolor th:nth-child(3) {
            width: 10%;
        }

        .thcolor th:nth-child(4) {
            width: 10%;
        }

        .thcolor th:nth-child(5) {
            width: 40%;
        }

        .btn {
            margin-left: 0.7em;
        }

        .btn-success {
            color:;
        }

        th {
            text-align: center;
        }

        .tablediv {
            float: left;
            width: 100%;
        }

        td {
            text-align: center;
        }

        @media screen and (max-width: 900px) {
            #nav {
                width: 25%;
            }

            #news {
                width: 100%;
                font-size: 70%;
            }

            .paneldiv {
                width: 100%;
                font-size: 90%;
            }

            .indexborder {
                margin-left: 35%;
                margin-right: 5%;
            }

            .footer-p {
                padding-left: 26%;
            }
        }

        @media screen and (max-width: 400px) {
            #nav {
                width: 25%;
            }

            .navfont {
                font-size: 1em;
            }

            #news {
                width: 100%;
                font-size: 60%;
            }

            .paneldiv {
                width: 100%;
                font-size: 65%;
            }

            .indexborder {
                margin-left: 35%;
                margin-right: 5%;
            }

            .footer-p {
                padding-left: 26%;
            }
        }
    </style>

</head>

<body class="bodycolor">








    <center>

        <div width="100%">

            <div class="box-inline indexdiv1 panel panel-default auto" align="center">

                <div class="panel panel-default panel-primary ">

                    <div class="panel-heading">
                        <h3 class="panel-title">成绩考核表</h3>

                    </div>
                    <div class="panel-body">

                        <?php

                        $sql = "SELECT g.Order1,g.Order2,g.Order3,g.Order4,g.Order5,g.remark,t.TeacherName,s.StudentName,s.Major,p.ProjectName
                                        from guidemark as g
                                        join project as p on g.Project_ProjectId = p.ProjectId
                                       JOIN student AS s ON p.Student_StudentId = s.StudentId
                                       JOIN teacher as t on t.TeacherId=s.Teacher_TeacherId
                                      where s.StudentId=$sid  and p.Year=" . $_SESSION["t-Year"];


                        $result = mysqli_query($conn, $sql);
                        $guide = mysqli_fetch_array($result);

                        ?>
                        <table class="table table-striped table-condensed ">
                            <caption>指导教师评分:</caption>
                            <caption>教师教师：<?=$guide[6]?></caption>
                            <thead>
                            <tr class="thcolor">
                                <th>序号</th>
                                <th>考核项目</th>
                                <th>满分</th>
                                <th>得分</th>
                                <th>评语</th>

                            </tr>




                            </thead>
                            <tr id="guide">
                                <td>1</td>
                                <td>工作态度与纪律</td>
                                <td>10</td>
                                <td  id="sore1"><?= $guide[0] ?> </td>
                                <td rowspan="5" id="guidemark"><?= $guide[5] ?></td>
                            </tr>
                            <tr>
                                <td>2</td>
                                <td>基本理论、专业知识、基本技能和外语水平</td>
                                <td>10</td>
                                <td  id="sore2"><?= $guide[1] ?></td>

                            </tr>
                            <tr>
                                <td>3</td>
                                <td>完成任务情况与水平（工作量及完成质量）</td>
                                <td>20</td>
                                <td  id="sore3"><?= $guide[2] ?></td>

                            </tr>
                            <tr>
                                <td>4</td>
                                <td>独立工作能力、分析解决问题和实际工作能力</td>
                                <td>15</td>
                                <td  id="sore4"><?= $guide[3] ?></td>

                            </tr>
                            <tr>
                                <td>5</td>
                                <td>创新能力</td>
                                <td>5</td>
                                <td  id="sore5"><?= $guide[4] ?></td>

                            </tr>
                        </table>
                        <?php
                        $sql1 = "SELECT th.Order6,th.Order7,th.remark,t.TeacherName
															FROM thesismark AS th
															JOIN project AS p ON th.Project_ProjectId = p.ProjectId
															JOIN teacher AS t ON th.Teacher_TeacherId = t.TeacherId
															JOIN student AS s ON p.Student_StudentId = s.StudentId
															where s.StudentId=$sid and p.Year=" . $_SESSION["t-Year"];

                        $result = mysqli_query($conn, $sql1);
                        $thesis = mysqli_fetch_array($result);

                        ?>
                        <table class="table table-striped table-condensed ">
                            <caption>评阅教师评分:</caption>
                            <caption>评阅教师:<?=$thesis[3]?></caption>

                            <thead>

                            <tr class="thcolor">
                                <th class="th1">序号</th>
                                <th class="th4">考核项目</th>
                                <th class="sore">满分</th>
                                <th class="sore">得分</th>
                                <th class="sore">评语</th>
                            </tr>
                            </thead>

                            <tr>
                                <td>6</td>
                                <td>质量（正确性、条理性、创造性和实用性）</td>
                                <td>12</td>
                                <td  id="sore6"><?= $thesis[0] ?></td>
                                <td rowspan="2" id="thesismark"><?= $thesis[2] ?></td>
                            </tr>
                            <tr>
                                <td>7</td>
                                <td>成果的技术水平（理论、分析、计算、实验和实物性能）</td>
                                <td>8</td>
                                <td  id="sore7"><?= $thesis[1] ?></td>

                            </tr>
                        </table>
                        <?php
                        $sql3 = "SELECT s.StudentId, r.Project_ProjectId, d.Order8,d.Order9,d.Order10,d.Order11,d.remark
FROM replymark AS r
JOIN project AS p ON r.Project_ProjectId = p.ProjectId
JOIN student AS s ON p.Student_StudentId = s.StudentId
JOIN dzsubject as d on p.ProjectId = d.Project_ProjectId
GROUP BY r.Project_ProjectId
HAVING s.StudentId =$sid";
                        $result = mysqli_query($conn, $sql3);
                        $remark = mysqli_fetch_array($result);

                        $ssql="select TeacherName FROM replymark as r
join project as p on p.ProjectId = r.Project_ProjectId
join teacher as t on t.TeacherId=r.ReplyMarkId
join student as s on s.StudentId=p.Student_StudentId
WHERE  StudentId=$sid";
                        $ssresult=$conn->query($ssql);

                        ?>
                        <table class="table table-striped table-condensed ">
                            <caption>答辩组教师评分</caption>
                            <caption>答辩组成员:
                                <?
                                while($ssrow=$ssresult->fetch_array()){
                                    echo $ssrow[0];
                                    echo "、";
                                }
                                ?>
                            </caption>
                            <thead>
                            <tr class="thcolor">
                                <th class="width:5%">序号</th>
                                <th class="th2">考核项目</th>
                                <th class="">满分</th>
                                <th>得分</th>
                                <th class="mark1" id="sore">评语</th>
                            </tr>
                            </thead>

                            <tr>
                                <td>8</td>
                                <td>完成任务情况与水平</td>
                                <td>5</td>
                                <td  id="sore8"><?= $remark[2] ?></td>
                                <td rowspan="5" id="replymark"><?= $remark[6] ?></td>
                            </tr>
                            <tr>
                                <td>9</td>
                                <td>论文、设计任务书、图纸与实物的质量</td>
                                <td>5</td>
                                <td  id="sore9"><?= $remark[3] ?></td>

                            </tr>
                            <tr>
                                <td>10</td>
                                <td>答辩时讲述的系统性及语言表达能力</td>
                                <td>5</td>
                                <td  id="sore10"><?= $remark[4] ?></td>

                            </tr>
                            <tr>
                                <td>11</td>
                                <td>回答问题的正确性</td>
                                <td>5</td>
                                <td  id="sore11"><?= $remark[5] ?></td>

                            </tr>
                        </table>
                        <button onclick="printmark()">打印成绩</button>
                    </div>
                </div>

            </div>

        </div>


<!--<footer class="indexfooter container-fluid  bottom">-->
<!--    <p class="footer-p" align="center">地址：广东省广州市从化区经济开发区高技术产业园广从南路548号 | 电话：020－87818918 邮编：510990 | 网站公安备案编号：4401840100050 粤ICP备：05085382号 站长统计</p>-->
<!--</footer>-->


<script>
    window.jQuery || document.write('<script src="../js/jquery-1.11.0.min.js"><\/script>')
</script>
<script type="text/javascript" src="../js/nav.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript">
    function printmark(){

        <?
        $sql="select * from grade WHERE  StduentId=$sid";
        $result=mysqli_query($conn,$sql);
        if(mysqli_num_rows($result)==0){
        $marktotal[0]=$guide[0]+$guide[1]+$guide[2]+$guide[3]+$guide[4];
        $marktotal[1]=$thesis[0]+$thesis[1];
        $marktotal[2]=$remark[2]+$remark[3]+$remark[4]+$remark[5];
        $marktotal[3]=$marktotal[0]+$marktotal[1]+$marktotal[2];
           $sql="insert into grade VALUES ('','$guide[7]','$sid','$guide[8]','$guide[9]','$guide[5]','$marktotal[0]','$thesis[2]','$marktotal[1]','$remark[6]','$marktotal[2]','$marktotal[3]')";

            if(mysqli_query($conn,$sql)){?>
                alert("成功");
            <?}
            else{?>
        alert("失败");
        <? }
         }else{?>
            alert("已插入");
       <? }
        ?>


        src="examtest.php?sid=<?=$sid?>";
        window.open(src);
    }

</script>
</body>

</html>